package com.hl.toolkit.server.tycoin.setting.slaverepository;

import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.setting.slaveentity.TycoinSysArea;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
 public interface TycoinSysAreaRepository extends AbstractRepository<TycoinSysArea, Long> {
	
 	
 	@Query("SELECT t FROM TycoinSysArea t WHERE t.parentCode IS NULL AND t.id<>1")
	List<TycoinSysArea> findAllProvince();
	
	@Query("SELECT t FROM TycoinSysArea  t WHERE t.parentCode =:areaCode")
	List<TycoinSysArea> findCityBycode(@Param("areaCode") String areaCode);

	@Query("SELECT t FROM TycoinSysArea t WHERE t.parentCode =:areaCode")
	List<TycoinSysArea> findAreaBycode(@Param("areaCode") String areaCode);
 
}
